//
// Created by Jisam on 2024/7/9.
//
#include <bits/stdc++.h>
#define PSI pair<string,int>
#define PII pair<int,int>
#define i64 long long
using namespace std;
const int N = 1e5 + 5;
int ans;
struct node{
    int x1,x2,y1,y2;
};
bool judge(node n,int i ,int j){
//    cout << n.x1 <<" "<< n.x2 <<" "<<  n.y1  <<" "<< n.y2 <<" \n";
    return (n.x1<= i && n.x2 >=i && n.y1 <= j && n.y2 >= j);
}
int x,y;
int n;
int a,b,g,k;
int cover = -1;
void solve() {
    cin >> n;
    vector<node> carpet(n + 2);
    for(int i = 1 ; i <= n ; i ++){
        cin >> a  >> b >> g >> k ;
        carpet[i].x1 = a;
        carpet[i].y1 = b;
        carpet[i].x2 = a + g;
        carpet[i].y2 = b + k;
    }
    cin >> x >> y;
    for(int i = 1 ; i <= n ; i ++){
        if(judge(carpet[i],x,y)) {
            cover = i;
        }
    }
    cout << cover <<"\n";
}

int main() {
    ios::sync_with_stdio(false),cin.tie(nullptr);
//    int T;cin >> T;while(T --)
    solve();
    return 0;
}